package com.dc.di.sf.dt;

/**
* @ClassName: MessageConvertFactory
* @Description: TODO
* @author zhangbinp
* @date Dec 15, 2011 11:13:38 AM
*/
public class MessageConvertFactory {
	
	public static MessageConvertInterface getMessageConvert(String messageFormat) throws InstantiationException, IllegalAccessException, ClassNotFoundException{
		String implFullName = MessageConvertInterface.IMPL_PACK_PATH + "." + messageFormat.toUpperCase() + MessageConvertInterface.IMPL_SUFFIX;
		MessageConvertInterface mci = (MessageConvertInterface) Class.forName(implFullName).newInstance();
		return mci;
	}
	
	public static void main(String[] args) {
		MessageConvertInterface convert;
		try {
			convert = getMessageConvert("JSON");
			convert.addMessageHeader(null,new StringBuilder());
			convert = getMessageConvert("xml");
			convert.addMessageHeader(null,new StringBuilder());
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}
}
